package com.dh;

public class Calc {

    public static int result; //声明变量

    //加
    public void jia(int a) {
        result = result + a;
    }

    //减
    public void jian(int a) {
//        result = result - 1; // bug
        result = result - a;
    }

    // 乘
    public void cheng(int a) {
        result = result * a;
    }

    //除
    public void chu(int a) {
        result = result / a;
    }

    //平方 没有实现
    public void pingfa(int a){

    }

    //开平方
    public void kaipingfa(int a){

        for(;;); // 死循环
    }

    //清除
    public void clear(){

        result = 0;
    }
    //获取结果
    public int getResult(){

        return result;
    }


}
